import time
def bubbleSort(a):
    for i in range(len(a) - 1):
        for e in range(len(a) - i - 1):
            if a[e] > a[e + 1]:
                a[e], a[e + 1] = a[e + 1], a[e]

def r (fl):
    f = open(fl)
    d = f.readlines()
    return d
m1 = r("m1_sorted.txt")
m2 = r("m2_reverse.txt")
m3 = r("m3_shuffle.txt")
t_s = time.time()
bubbleSort(m1)
t_f = time.time()
print("m1_sorted", round((t_f-t_s)*1000), "milliseconds")

t_s = time.time()
bubbleSort(m2)
t_f = time.time()
print("m2_reverse", round((t_f-t_s)*1000), "milliseconds")

t_s = time.time()
bubbleSort(m3)
t_f = time.time()
print("m3_shuffle", round((t_f-t_s)*1000), "milliseconds")